package com.tping.design.singleton;

/**
 *
 * 静态内部类
 *
 * @author xiai
 * @Date 2023/2/8 12:55
 * @Version 1.0
 */
public class SingletonTypeInnerClass {

    private SingletonTypeInnerClass(){}

    /**
     * 当前SingletonTypeInnerClass被加载的时候，Singleton没有被加载，保证懒加载
     * 基于类加载机制，初始化的时候是线程安全
     */
    private static class Singleton {
        private static final SingletonTypeInnerClass INSTANCE = new SingletonTypeInnerClass();
    }
    public static SingletonTypeInnerClass getInstance(){
        return Singleton.INSTANCE;
    }
}
